package com.yc154.springmvc1.demos.entity;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.util.Date;

@Data
public class User {

    @NotBlank(message = "请输入用户名!")
    @Length(min = 2, max=20, message = "账号必须是2~20字符!")
    String name;
    @Length(min = 6, max=16, message = "密码必须是6~16字符!")
    @NotBlank(message = "请输入用密码!")
    @Pattern(regexp = "[a-zA-Z]\\w{5,15}", message = "密码必须是字母开头的单词符构成!")
    String pwd;
    @Past(message = "生日必须是过去的时间")
    Date birthday;
    @Pattern(regexp = "1\\d{10}|0\\d{2,3}-\\d{7,8}", message = "电话号码格式错误!")
    String phone;
    @Email
    String email;
    // TODO 扩展
    String idCard;
    @Min(message = "金额必须大于1000", value = 1000)
    @Max(message = "金额必须小于5000", value = 5000)
    int money;













    int age;
    Boolean boby;
    User mather;
    User father;

    public User getMather() {
        return mather;
    }

    public void setMather(User mather) {
        this.mather = mather;
    }

    public User getFather() {
        return father;
    }

    public void setFather(User father) {
        this.father = father;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getBoby() {
        return boby;
    }

    public void setBoby(Boolean boby) {
        boby = boby;
    }
}
